package org.fhm.zdte.common.standard;


import org.fhm.zdte.common.annotation.InternalProvider;
import org.fhm.zdte.common.annotation.Provider;
import org.fhm.zdte.common.exception.ServletException;
import org.fhm.zdte.common.pojo.Result;
import org.fhm.zdte.common.pojo.Servlet;

import java.util.List;
import java.util.Map;

/**
 * The interface standard of the Interface-Scheduler.
 *
 * @author 谭波
 * @since 2023/12/28
 */
@SuppressWarnings("unused")
public interface IInterfaceScheduler {

    /**
     * Scan the beans are tagged by {@link Provider} or {@link InternalProvider} to obtain {@link Servlet} information,
     * create a {@link Servlet} and store it.
     *
     * @param beans The beans are tagged by {@link Provider} or {@link InternalProvider}
     * @throws ServletException throw when an error occurs during the creation of a {@link Servlet}.
     */
    void mappingInterfaceWithMethods(List<?> beans) throws ServletException;

    /**
     * Filter out {@link Servlet} via the Interface-Url and invoked it's the method.
     *
     * @param from         The identification of invoker side.
     * @param interfaceUrl Interface-Url
     * @param params       The method arguments of {@link Servlet}.
     * @return Response result.
     */
    Result<?> invokedMethodByInterfaceUrl(String from, String interfaceUrl, Map<String, Object> params);

}
